#include <iostream>
// climits 库包含了整形的限制信息
#include <climits>

using namespace std;

void intType();
void jinzhiType();
void cast();
int main(){
	
	cast();
}
// 类型转换
void cast(){
	// 将 double转为 float, 将只能保证6位有效位
	float d1 = 2.989878347638d;
	long long n1 = 39999999129;
	// 将n1转换为 int类型 赋值给in2
	int in2(n1);
	const int cona = 8;
	// 将 in2转换为 long赋值给cc
	long cc{in2};
	
	cout << "d1 = " << d1 << endl;
	cout << "n1 = " << n1 << endl;
	cout << "in2 = " << in2 << endl;
	cout << "cc = " << cc << endl;
	cout << "cona = " << cona << endl;
	cout << "the char of 65 is " << static_cast<char>(65) << endl;
}
// 不同进制整数的表达形式
void jinzhiType(){
	int decNum = 36; // 十进制：第一位是 1-9
	int octNum = 036;  // 8进制：第一位是0 ,第二位 是 0-7
	int hexNum = 0x36; // 16进制：0x开头
	cout << "decNum is " << decNum << endl;
	cout << "octNum is " << octNum << endl;
	cout << "hexNum is " << hexNum << endl;
}

void intType(){
	
	// 各种数据类型的宽度 单位：字节
	cout << "size of char: " << sizeof(char) << endl;
	cout << "size of short: " << sizeof(short) << endl;
	cout << "size of int: " << sizeof(int) << endl;
	cout << "size of double: " << sizeof(double) << endl;
	cout << "size of long: " << sizeof(long) << endl;
	cout << "size of long long: " << sizeof(long long) << endl;
	
	// 每个字节的宽度
	cout << "bits per byte: " << CHAR_BIT <<  endl;
	// MAX VALUE of different type
	cout << "max INT: " << INT_MAX << endl;
	cout << "max LONG: " << LONG_MAX << endl;
	cout << "max LONG LONG: " << LLONG_MAX << endl;
}